﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SaleReturnBillLevel.aspx.cs" Inherits="Main_Inventory_SaleReturnBillLevel"  Culture="en-GB"%>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Sale Invoice</title>
    <link rel="Stylesheet" href="../../Styles/accounts.css" type="text/css" />
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
    <%--<script src="../../Menu/js/jquery.min.js" type="text/javascript"></script>  --%>
    <script src="../../JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script>
    <link href="../../Styles/HorizontalTab.css" rel="stylesheet" type="text/css" />
    <script src="../../JavaScript/HorizontalTab.js" type="text/javascript"></script>
    
    <script type="text/javascript">       

        function GetQuantity(hidItemId, CtrlId, HidLocationId) {
            if (hidItemId != '' && parseFloat(hidItemId) > 0) {
                var ctrlIndex = HidLocationId.toString();
                var LocationIdandQty = document.getElementById(ctrlIndex).value;
                window.open('WinSaleQty.aspx?ItemId=' + hidItemId + '&CtrlId=' + CtrlId + '&HidLocationId=' + HidLocationId + '&LocationIdandQty=' + LocationIdandQty, '', 'width=700, height=400, resizable=0');
            }
            else {
                alert('Choose Item First');
                return false;
            }
        }

        function CalculateAmtBillLevel() {
            var Count = document.getElementById("hidControlBillLevel").value;
            var hidTranFormatType = document.getElementById("hidTranFormatType").value;
            var TotalQty = 0;
            var TotalAmount = 0;
            var TotalTax = 0;
            if (hidTranFormatType == 'False') {
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txtQuantityBillLevel" + i);
                    var RateAmt = document.getElementById("txtRateBillLevel" + i);
                    var TaxRate = document.getElementById("hidTaxRateBillLevel" + i);
                    var TaxAmount = document.getElementById("hidTaxAmtBillLevel" + i);
                    var ItemAmount = document.getElementById("txtTotalAmountBillLevel" + i);
                    var itemAmt = 0;
                    var taxAmt = 0;
                    if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                        TotalQty += parseFloat(Qty.value);
                        if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                            itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                            TotalAmount += parseFloat(itemAmt);

                            if (TaxRate.value != '' && parseFloat(TaxRate.value) > 0) {
                                taxAmt = (parseFloat(itemAmt) * parseFloat(TaxRate.value)) / 100;
                            }
                            TotalTax += parseFloat(taxAmt);
                        }
                        document.getElementById("txtTotalAmountBillLevel" + i).value = parseFloat(itemAmt).toFixed(2);
                        document.getElementById("hidTaxAmtBillLevel" + i).value = parseFloat(taxAmt).toFixed(2);
                    }
                }
            }
            else if (hidTranFormatType == 'True') {
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txtQuantityBillLevel" + i);
                    var RateAmt = document.getElementById("txtRateBillLevel" + i);
                    var TaxRate = document.getElementById("hidTaxRateBillLevel" + i);
                    var TaxAmount = document.getElementById("hidTaxAmtBillLevel" + i);
                    var ItemAmount = document.getElementById("txtTotalAmountBillLevel" + i);
                    var itemAmt = 0;
                    var taxAmt = 0;
                    var TotalItemAmt = 0;
                    if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                        TotalQty += parseFloat(Qty.value);                        
                        if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                            itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                            if (TaxRate.value != '' && parseFloat(TaxRate.value) > 0) {
                                taxAmt = (parseFloat(itemAmt) * parseFloat(TaxRate.value)) / 100;
                            }
                            TotalTax += parseFloat(taxAmt);
                        }
                        TotalItemAmt = parseFloat(itemAmt) + parseFloat(taxAmt);
                        TotalAmount += parseFloat(TotalItemAmt);
                        document.getElementById("txtGrossAmtBillLevel" + i).value = parseFloat(itemAmt).toFixed(2);
                        document.getElementById("txtTaxAmountBillLevel" + i).value = parseFloat(taxAmt).toFixed(2);                        
                        document.getElementById("txtTotalAmountBillLevel" + i).value = parseFloat(TotalItemAmt).toFixed(2);
                    }
                }
            }
            var grossTotal = TotalAmount + TotalTax;
            document.getElementById("txtTotalItemBillLevel").value = TotalQty.toFixed(2);
            document.getElementById("txtPreTaxBillLevel").value = TotalAmount.toFixed(2);
            document.getElementById("txtTaxableAmtBillLevel").value = TotalAmount.toFixed(2);
            document.getElementById("txtVatBillLevel").value = TotalTax.toFixed(2);
            document.getElementById("txtPostTaxBillLevel").value = grossTotal.toFixed(2);
            var roundOff = 0;
            roundOff = document.getElementById("txtRoundOffBillLevel").value;
            if (roundOff == '') {
                roundOff = 0;
            }
            var GrandTotal = grossTotal + parseFloat(roundOff);
            document.getElementById("txtGrandTotalBillLevel").value = GrandTotal.toFixed(2);
        }
        function EnabledTabKey(id, e) {
            var keycode;
            if (window.event) {
                keycode = window.event.keyCode;
            }
            else if (e) {
                keycode = e.which;
            }
            else {
                return true;
            }

            if (keycode == 9) {
                // if is the tab key                
                return true;
            }
            else {
                return false;
            }
        }
        function ValidateItems() {
            var flag = true;
            var Count = document.getElementById("hidControlBillLevel").value;
            var hidTranFormatType = document.getElementById("hidTranFormatType").value;
            if (hidTranFormatType == 'False') {
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txtQuantityBillLevel" + i);
                    var RateAmt = document.getElementById("txtRateBillLevel" + i);
                    if (Qty.value == '' || Qty.value == '0') {
                        alert('Please Specify Return Quantity At Row No. ' + i);
                        document.getElementById("txtQuantityBillLevel" + i).focus();
                        flag = false;
                        return false;
                        break;
                    }
                    else if (RateAmt.value == '' || RateAmt.value == '0') {
                        alert('Please Specify Item Amount At Row No. ' + i);
                        document.getElementById("txtRateBillLevel" + i).focus();
                        flag = false;
                        return false;
                        break;
                    }
                }
                if (document.getElementById("ddlVatBillLevel").value == '0') {
                    alert('Please Specify Tax Type ');
                    document.getElementById("ddlVatBillLevel").focus();
                    flag = false;
                }
                else if (document.getElementById("ddlSaleLedger").value == '0') {
                    alert('Please Specify Sale Ledger');
                    document.getElementById("ddlSaleLedger").focus();
                    flag = false;
                }
                else if (document.getElementById("ddlSaleTaxLedger").value == '0') {
                    alert('Please Specify Sale Tax Ledger');
                    document.getElementById("ddlSaleTaxLedger").focus();
                    flag = false;
                }
            }
            if (hidTranFormatType == 'True') {
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txtQuantityBillLevel" + i);
                    var RateAmt = document.getElementById("txtRateBillLevel" + i);
                    var DllTaxType = document.getElementById("ddlTaxType" + i);
                    var DdlSaleLedger = document.getElementById("ddlSaleLedger" + i);
                    var DllSaleTaxType = document.getElementById("ddlSaleTaxLedger" + i);
                    if (Qty.value == '' || Qty.value == '0') {
                        alert('Please Specify Return Quantity At Row No. ' + i);
                        document.getElementById("txtQuantityBillLevel" + i).focus();
                        flag = false;
                        break;
                    }
                    else if (RateAmt.value == '' || RateAmt.value == '0') {
                        alert('Please Specify Item Amount At Row No. ' + i);
                        document.getElementById("txtRateBillLevel" + i).focus();
                        flag = false;
                        break;
                    }
                    else if (DllTaxType.value == '0') {
                        alert('Please Specify Tax Type At Row No. ' + i);
                        document.getElementById("ddlTaxType" + i).focus();
                        flag = false;
                        break;
                    }
                    else if (DdlSaleLedger.value == '0') {
                        alert('Please Specify Sale Ledger At Row No. ' + i);
                        document.getElementById("ddlSaleLedger" + i).focus();
                        flag = false;
                        break;
                    }
                    else if (DllSaleTaxType.value == '0') {
                        alert('Please Specify Sale Tax At Row No. ' + i);
                        document.getElementById("ddlSaleTaxLedger" + i).focus();
                        flag = false;
                        break;
                    }
                }
                return flag;
            }
        }


        function ValidateMain() {
            var flag = true;
            if (document.getElementById("ddlFormat").value == '0') {
                alert('Please Specify Transaction Format');
                document.getElementById("ddlFormat").focus();
                flag = false;
            }
            else if (document.getElementById("ddlCustomer").value == '0') {
                alert('Please Specify Customer/Vender');
                document.getElementById("ddlCustomer").focus();
                flag = false;
            }
            else if (document.getElementById("txtVoucher").value == '') {
                alert('Please Specify Voucher Number');
                document.getElementById("txtVoucher").focus();
                flag = false;
            }
            else if (document.getElementById("ddlTaxGroup").value == '0') {
                alert('Please Specify Tax Group');
                document.getElementById("ddlTaxGroup").focus();
                flag = false;
            }
            else if (document.getElementById("txtDate").value == '' || document.getElementById("txtDate").value == '__/__/____') {
                alert('Please Specify Transaction Date');
                document.getElementById("txtDate").focus();
                flag = false;
            }
            else if (document.getElementById("hidControlBillLevel").value == '0') {
                alert('Please Specify Items For Sale Return');                
                flag = false;
            }                      
            return flag;
        }
        
        function Validation() {
            if (ValidateMain() && ValidateItems()) {
                return true;
            }
            else {
                return false;
            }
          
        }
        function roundOff() {
            var postTotal = 0;
            var roundOff = 0;
            postTotal = document.getElementById("txtPostTaxBillLevel").value;
            roundOff = document.getElementById("txtRoundOffBillLevel").value;
            if (postTotal == '') {
                postTotal = 0;
            }
            if (roundOff == '') {
                roundOff = 0;
            }
            var GrandTotal = parseFloat(postTotal) + parseFloat(roundOff);
            document.getElementById("txtGrandTotalBillLevel").value = GrandTotal.toFixed(2);
        }
        function OpenWindow() {
            var ddl = document.getElementById("ddlCustomer");
            var ddlValue = ddl.options[ddl.selectedIndex].value;
            var curDate = document.getElementById("txtDate").value;
            if (curDate == '') {
                var currentTime = new Date()
                var month = currentTime.getMonth() + 1
                var day = currentTime.getDate()
                var year = currentTime.getFullYear()
                curDate = day + '/' + month + '/' + year;
            }
            if (parseFloat(ddlValue) > 0) {
                window.open('SaleReturnItems.aspx?Lid=' + ddlValue + '&CurDate=' + curDate, '', 'resizeable=1, scrollbars=1,width=600, height=500');
            }
            else {
                alert('Select Customer first');
                return false;
            }
        }
        function CreateEvent() {
            document.getElementById("btnCreateItem").click(); 
        }
    </script>  
<style type="text/css">   
.messageBox
    {
        text-decoration:none;        
        padding-left:7px;
        padding-right:7px;
        display:block;
        padding-top:3px;
        padding-bottom:3px;
        background-color:#61A737;
        text-align:center;
        color:White;
        font-weight:bold;
        width:55px;
    }
</style>
</head>
<body >
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
</asp:ScriptManager>
<%--<div class="divmain" style="width:110%;">
--%>        <acc:heading ID="pagehead" runat="server" HeadingText="Sale Return" /> 
  
           
        <div style="width:100%; margin-left:5%; margin-right:5%; margin-top:20px;">        
          <%--  <asp:UpdatePanel ID="UpdatePanel1" runat="server">   
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
                </Triggers>         
                <ContentTemplate>--%>
                     <div style="margin-left:5%; margin-right:5%; width:90%" align="center">
                        <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
                        <asp:HiddenField ID="hidCountReturnRow" runat="server" Value="0" />
                     </div>
                    <asp:HiddenField ID="hidTranFormatType" runat="server"/>
                    <table class="tablecontent" style="width:100%">
                        <tr>
                            <td class="headtd" colspan="4">
                               Sale Return
                           </td>
                        </tr>
                        <tr >
                            <td style="width:12%">
                                Bill Format<span style="color:Red">*</span>
                                <asp:HiddenField ID="hidTaxLevel"  runat="server" />
                            </td>
                            <td style="width:35%;">
                                <asp:DropDownList ID="ddlFormat" runat="server" Width="175px" CssClass="dropdown" OnSelectedIndexChanged="ddlFormat_OnSelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>                                
                                <%--<asp:RequiredFieldValidator ID="reqFormat" runat="server" ControlToValidate="ddlFormat" ValidationGroup="V" InitialValue="0" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>--%>
                            </td>
                            <td style="width:12%">
                                Customer<span style="color:Red">*</span>
                            </td>
                            <td style="width:41%">
                                <asp:DropDownList ID="ddlCustomer" runat="server" Width="240px" CssClass="dropdown" OnSelectedIndexChanged="ddlCustomer_OnSelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>                               
                                <%--<asp:RequiredFieldValidator ID="reqSupplier" runat="server" ControlToValidate="ddlCustomer" InitialValue="0" ValidationGroup="V" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>--%>
                            </td>
                         </tr>
                        <tr >
                            <td>
                                Bill No.<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:TextBox ID="txtPrefix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="prefixWater" runat="server" TargetControlID="txtPrefix" WatermarkText="Prefix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                                <asp:TextBox ID="txtVoucher" runat="server" Width="70px" CssClass="inputnumber" ValidationGroup="V" MaxLength="10" ></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="voucherWater" runat="server" TargetControlID="txtVoucher" WatermarkText="Number" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>                            
                                <asp:TextBox ID="txtSuffix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="suffixWater" runat="server" TargetControlID="txtSuffix" WatermarkText="Suffix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                                <%--<asp:RequiredFieldValidator ID="reqVoucher" runat="server" SetFocusOnError="true" ControlToValidate="txtVoucher" ValidationGroup="V" Display="Dynamic"></asp:RequiredFieldValidator>--%>
                            </td>                            
                            <td >
                                Tax Group<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:DropDownList ID="ddlTaxGroup" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTaxGroup_OnSelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                            <%--<asp:RequiredFieldValidator ID="reqTaxGroup" runat="server" InitialValue="0" SetFocusOnError="true" ControlToValidate="ddlTaxGroup" ValidationGroup="V" Display="Dynamic"></asp:RequiredFieldValidator>--%>&nbsp;
                                
                            </td>
                        </tr>
                        <tr >
                            <td >
                                Date<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:TextBox ID="txtDate" runat="server" Width="120px" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                <%--<asp:RequiredFieldValidator ID="reqDate" runat="server" ControlToValidate="txtDate" ValidationGroup="V" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>--%>&nbsp;
                                <asp:ImageButton ID="btnDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                                <AjaxControl:CalendarExtender ID="cal" runat="server" PopupButtonID="btnDate" TargetControlID="txtDate" Format="dd/MM/yyyy"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskExt" runat="server" MaskType="Date" Mask="99/99/9999" TargetControlID="txtDate" CultureName="pt-BR"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValid" runat="server" ControlExtender="maskExt" InvalidValueMessage="Invalid Date" IsValidEmpty="true" Display="Dynamic" ValidationGroup="V" ControlToValidate="txtDate"></AjaxControl:MaskedEditValidator>                             
                              
                            </td>
                            <td >
                               Cash/Credit                             
                            </td>
                            <td>
                                <div style="float:left"> 
                                    <asp:RadioButtonList ID="rbtCashCredit" runat="server" RepeatDirection="Horizontal">
                                        <asp:ListItem Text="Cash" Value="0" Selected="True"></asp:ListItem>
                                        <asp:ListItem Text="Credit" Value="1"></asp:ListItem>
                                    </asp:RadioButtonList>
                                </div> 
                                <div style="float:left"> 
                                    &nbsp;<asp:TextBox ID="txtCreditDay" runat="server" onKeyPress="return isNumberKey(this.id,event)" Width="60px" CssClass="inputnumber" MaxLength="3"></asp:TextBox>&nbsp;Days                                                           
                                </div>
                                
                                
                                <%--<asp:RequiredFieldValidator ID="reqBillRef" runat="server" ControlToValidate="txtBillRef1" ValidationGroup="V" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>--%>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                P.O. Ref:  
                            </td>
                            <td>
                                <asp:TextBox ID="txtBillRef1" runat="server" Width="90px" CssClass="input" ValidationGroup="V" MaxLength="20"></asp:TextBox>
                                <asp:TextBox ID="txtBillRef2" runat="server" Width="80px" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                <AjaxControl:CalendarExtender ID="extCalbill" runat="server" Format="dd/MM/yyyy" TargetControlID="txtBillRef2"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskRefDate" runat="server" Mask="99/99/9999" TargetControlID="txtBillRef2" MaskType="Date" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValidRef" runat="server" ControlExtender="maskRefDate" ControlToValidate="txtBillRef2" ValidationGroup="V" InvalidValueMessage="*"></AjaxControl:MaskedEditValidator>
                            </td>
                        </tr>
                    </table>
         <%--   </ContentTemplate>
         </asp:UpdatePanel>  --%>
        </div>
        <asp:Panel ID="panelBillLevel" runat="server" Width="110%">
            <div id="wrapper">    
                <ul class="tabs">
                    <li><a href="javascript:void(0)" class="defaulttab" rel="tabGeneralBillLevel">General</a></li>
                    <li><a href="javascript:void(0)" rel="tabOtherBillLevel">Other</a></li>                   
                </ul> 
            </div>   
            <div class="tab-content" id="tabGeneralBillLevel" runat="server">
            <%--<asp:UpdatePanel ID="UpdatePanel2" runat="server">    
             <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />                    
                    <asp:AsyncPostBackTrigger ControlID="ddlFormat" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlCustomer" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlTaxGroup" EventName="SelectedIndexChanged" />
             </Triggers>                      
            <ContentTemplate>       --%>     
                <div style="width:100%">
                    <asp:HiddenField ID="hidControlBillLevel" Value="0" runat="server" />                 
                    <table id="tblBillLevel" runat="server" style="width:100%" class="tablecontent" cellpadding="2" cellspacing="0" visible="false">
                        <tr>
                            <td style ="width:25%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item(s)</td>
                            <td style ="width:15%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Unit</td>
                            <td style ="width:20%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Qty.</td>
                            <td style ="width:10px; border-right:1px solid #818181; border-bottom:1px solid #818181;" class="headtd">&nbsp;</td>
                            <td style ="width:20%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Rate</td>                          
                            <td style ="width:20%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item Amt</td>                        
                        </tr> 
                    </table>
                    <table id="tblItemLevel" runat="server" style="width:100%" class="tablecontent" cellpadding="2" cellspacing="0" visible="false">    
                        <tr>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item(s)</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Unit</td>
                            <td style ="width:10%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Qty.</td>
                            <td style ="width:10px; border-right:1px solid #818181; border-bottom:1px solid #818181;" class="headtd">&nbsp;</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Rate</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Gross Amt.</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Tax</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Tax Amt</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item Amt</td>
                            <td style ="width:10%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Sale Ledger</td>                                                                       
                            <td style ="width:10%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Tax Ledger</td>                        
                        </tr>             
                    </table>
                    <table style="width:98%; margin:5px;" align="right" >
                        <tr>
                            <td> 
                            <asp:HyperLink ID="hyperOpenItem" runat="server" NavigateUrl="#" Text="Choose Items from Bill..." onclick="OpenWindow();"></asp:HyperLink>
                                <%--<asp:LinkButton ID="btnAddMoreBillLevel" runat="server" OnClick="btnAddMoreBillLevel_Click"> 
                                    <img src="../../Images/More.jpg" alt="Add New Row" />
                                </asp:LinkButton> --%>
                            </td>
                        </tr>
                    </table>
                </div>  
           <%-- </ContentTemplate>           
            </asp:UpdatePanel>      --%>            
                <div style="width:100%"> 
               <%-- <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                 <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
                     <asp:AsyncPostBackTrigger ControlID="ddlFormat" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlCustomer" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlTaxGroup" EventName="SelectedIndexChanged" />
                </Triggers>    
                <ContentTemplate>--%>
                <div style="width:50%; float:left" align="left">
                    <asp:Panel ID="panelSaleBillLevel" runat="server">
                    <table>
                        <tr>
                            <td>
                                Sales Ledger :
                            </td>
                             <td>
                                <asp:DropDownList ID="ddlSaleLedger" runat="server" CssClass="dropdown"></asp:DropDownList>
                            </td>
                        </tr>
                         <tr>
                            <td>
                                Tax Ledger :
                            </td>
                             <td>
                                <asp:DropDownList ID="ddlSaleTaxLedger" runat="server" CssClass="dropdown"></asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                    </asp:Panel>
                </div>               
                <div style="width:50%; float:right" align="left">
                <table style="width:98%; text-align:left;">
                    <tr>
                        <td style="width:70%">
                            Total Item
                        </td>
                        <td style="width:30%">
                            <asp:TextBox ID="txtTotalItemBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Pre Tax Total
                        </td>
                        <td>
                             <asp:TextBox ID="txtPreTaxBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Taxable Amount
                        </td>
                        <td>
                             <asp:TextBox ID="txtTaxableAmtBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            VAT/CST &nbsp;<asp:DropDownList ID="ddlVatBillLevel" Width="150px" CssClass="dropdown" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlVatBillLevel_OnSelectedIndexChanged"></asp:DropDownList>
                            <asp:HiddenField ID="hidTaxRateBillLevelMain" runat="server" />
                        </td>
                        <td>
                             <asp:TextBox ID="txtVatBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Post Tax Total
                        </td>
                        <td>
                             <asp:TextBox ID="txtPostTaxBillLevel" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Round off Amount
                        </td>
                        <td>
                             <asp:TextBox ID="txtRoundOffBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return isNumberKey(this.id,event)" AutoCompleteType="Disabled" Text="0.00" onblur="return roundOff();"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Grand Total
                        </td>
                        <td>
                             <asp:TextBox ID="txtGrandTotalBillLevel" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    
                    </table>
                   </div> 
              <%--  </ContentTemplate>
                </asp:UpdatePanel>--%>
            </div>            
                
            <div style="clear:both;"> &nbsp;</div>
            </div>        
            <div class="tab-content" ID="tabOtherBillLevel" runat="server">
               <%-- <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="ddlFormat" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlCustomer" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="ddlTaxGroup" EventName="SelectedIndexChanged" />
                </Triggers>    
                <ContentTemplate>         --%>       
                        <div style="width:100%">
                            <div style="width:48%; float:left; margin-right:2%">
                                <table style="width:100%">
                                    <tr>
                                        <td style="width:30%">
                                            Billing Address
                                        </td>
                                        <td style="width:70%">
                                            <asp:TextBox ID="txtBillAddress" runat="server" TextMode="MultiLine" CssClass="input" Width="97%" Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:30%">
                                            Delivery Address
                                        </td>
                                        <td style="width:70%">
                                            <asp:TextBox ID="txtDeliveryAdd" runat="server" TextMode="MultiLine" CssClass="input" Width="97%"  Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <%-- <tr>
                                        <td style="width:30%">
                                            Terms of Delivery
                                        </td>
                                        <td style="width:70%">
                                            <asp:TextBox ID="txtDeliveryTerms" runat="server" TextMode="MultiLine" CssClass="input" Width="97%"  Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>--%>
                                </table>                              
                            </div>
                            <div style="width:48%; float:left;">
                            <table style="width:100%">
                                    <tr>
                                        <td style="width:40%">
                                            Mode of Delivery
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtDeliveryMode" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Delivery Date
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtDeliveryDate" runat="server" Width="97%" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                            <AjaxControl:CalendarExtender ID="extCal2" runat="server" TargetControlID="txtDeliveryDate" Format="dd/MM/yyyy" ></AjaxControl:CalendarExtender>
                                            <AjaxControl:MaskedEditExtender ID="maskDeliveryDate" runat="server" TargetControlID="txtDeliveryDate" MaskType="Date" Mask="99/99/9999" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                            <AjaxControl:MaskedEditValidator ID="maskValidDelivery" InvalidValueMessage="Invalid Date" runat="server" ControlToValidate="txtDeliveryDate" ControlExtender="maskDeliveryDate" IsValidEmpty="true" ValidationGroup="V"></AjaxControl:MaskedEditValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Document NO.
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtDocumentNo" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Transporter Name
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtTransporter" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Vehicle Number
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtVehicle" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>                                   
                                    <%--<tr>
                                        <td style="width:40%">
                                           Sale Person:
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtSalesPerson" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>--%>
                                    <tr>
                                        <td style="width:40%">
                                            Prepared By
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtPreparedBy" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Checked By
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtCheckedBy" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Authorized Signatory
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtSignatory" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Narration
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtNarration" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Remarks
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtRemark" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr> 
                                </table>
                            </div>
                        </div>                       
                
              <%--  </ContentTemplate>
              </asp:UpdatePanel> --%>
              <div style="clear:both">&nbsp;</div>
              </div>
            <asp:LinkButton ID="lnkModal" runat="server"></asp:LinkButton>
            <asp:Panel ID="panelFormatMessage" runat="server" Width="250px" Height="130px" CssClass="modalPopup" style="display:none; border:solid 1px #05DB35">
                <div style="width:100%; height:100px">
                <table width="100%" cellspacing="0" cellpadding="2">
                    <tr>
                        <td colspan="2" style="background-color:#61A737; color:White"><b>INVENTORY</b></td>
                    </tr>
                    <tr>
                        <td style="padding-top:5px">
                            <img src="../../Images/questionMark.jpg"/>
                        </td>
                        <td>
                            No sales Return Format found<br />
                            Do you want to create Bill Format!<br />
                        </td>
                    </tr>
                </table>
                </div>
                <div style="width:100%; height:30px">
                    <table width="100%">
                        <tr>
                            <td style="width:50%; padding-right:3px" align="right">
                                <asp:HyperLink ID="hyperTranFormat" runat="server" NavigateUrl="~/Main/Inventory/TransFormat.aspx" CssClass="messageBox">OK</asp:HyperLink>
                            </td> 
                            <td>
                                <asp:HyperLink ID="hyperCancelFormat" runat="server" NavigateUrl="~/Welcome.aspx" CssClass="messageBox">CANCEL</asp:HyperLink>
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
            <AjaxControl:ModalPopupExtender ID="modalFormatExtender" runat="server" TargetControlID="lnkModal" PopupControlID="panelFormatMessage" BackgroundCssClass="modalBackground"></AjaxControl:ModalPopupExtender>         
            <asp:Panel ID="panelCustMessage" runat="server" Width="250px" Height="130px" CssClass="modalPopup" style="display:none; border:solid 1px #05DB35">
                <div style="width:100%; height:100px">
                <table width="100%" cellspacing="0" cellpadding="2">
                    <tr>
                        <td colspan="2" style="background-color:#61A737; color:White"><b>INVENTORY</b></td>
                    </tr>
                    <tr>
                        <td style="padding-top:5px">
                            <img src="../../Images/questionMark.jpg"/>
                        </td>
                        <td>
                            No Sales Invoice Found! <br />
                        </td>
                    </tr>
                </table>
                </div>
                <div style="width:100%; height:30px">
                    <table width="100%">
                        <tr>
                            <td  align="center">
                                <asp:HyperLink ID="hyperCustMessage" runat="server" NavigateUrl="~/Welcome.aspx" CssClass="messageBox">OK</asp:HyperLink>
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
            <AjaxControl:ModalPopupExtender ID="modalCustExtender" runat="server" TargetControlID="lnkModal" PopupControlID="panelCustMessage" BackgroundCssClass="modalBackground"></AjaxControl:ModalPopupExtender>
         
            <div style="width:98%">
            <%--<asp:UpdatePanel ID="UpdatePanel4" runat="server">                    
            <ContentTemplate>--%>
                        
            <table style="width:98%; text-align:center">
                <tr>
                    <td>
                        <asp:Button ID="btnSubmit" Text="Submit" runat="server" CssClass="button" OnClientClick="return Validation();" OnClick="btnSubmit_Click"/> &nbsp;
                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CssClass="button" /> 
                    </td>
                </tr>
            </table> 
            <asp:Button ID="btnCreateItem" runat="server" Text="Create" style="display:none"  OnClick="btnCreateItem_Click" />
            <%--</ContentTemplate>
            </asp:UpdatePanel>  --%>
            </div>
        </asp:Panel> 
     <%--</div>--%>
     
</form>
</body>
</html>




